<?php
/* OpenBIBLIO -- A library administration web interface
 * Copyright (C) 2002-2005 Fr&eacute;d&eacute;ric Descamps <lefred@tiscali.be>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */

if(isset($_GET['id'])) 
	$id = $_GET['id'];
elseif (isset($_POST['id']))
	$id = $_POST['id'];
else $id = FALSE;

if (!empty($id))
	$book = get_book($id);
else 
	$book = FALSE;
if(!$book) {
        include("includes/search.inc");
}
else {
	if (isset($_GET['sw']))
		$sw =$_GET['sw'];
	elseif (isset($_POST['sw']))
		$sw = $_POST['sw'];
	else 
		$sw= FALSE;
	if ($sw) {
		$requete = "update livres set del = 1 where id=$id";
		if(!($resultat = biblio_db_query($requete))) { 
			echo "PROBLEME : " .biblio_db_error(); 
			exit;
		}  
		put_log(4, $requete, $user);
		echo "<center><br/>";
		echo _("Ce livre a &eacute;t&eacute; &eacute;ffac&eacute;.");
		echo "</center>";   
	}
	else {
		$liv_nom = $book['nom'];
		$liv_num = $book['num'];
		$liv_auteur = $book['auteur'];
?>
		<center>
			<h3><?php echo $liv_nom; if (($liv_num) && !empty($liv_num)) echo "($liv_num)";?></h3>
			<i><?php echo $liv_auteur; ?></i>
			<br/><br/>
			<form action="admin.php" method="GET">
				<input type="hidden" name="action" value="del"/>
				<input type="hidden" name="type" value="livre"/>
				<input type="hidden" name="sw" value="1"/>
				<input type="hidden" name="id" value="<?php echo $id; ?>"/>
				<input type="submit" value="<?php echo _("Confirmer l'effacement"); ?>"/>
			</form>
<?php
	}
}
?>
<br/><br/>
<div>
	<span id=left-text>
		<a href="admin.php?menu=1"><?php echo _("retour menu administration"); ?></a><br/>
		<a href="index.php"><?php echo _("retour menu principal"); ?></a>
	</span>
</div>
<br/>
